package pack.controls;

import pack.core.Jogo;

import com.jme.input.controls.GameControl;
import com.jme.input.controls.controller.ControlChangeListener;
import com.jmex.game.state.GameStateManager;

public class InGameListener implements ControlChangeListener 
{
    public final void changed(final GameControl control, final float oldValue,
            final float newValue, final float time) {
        if (newValue == 1.0f) {
        	if (control.getName().equals("exit")) {
        		GameStateManager.getInstance().deactivateChildNamed("PlanetaFraternus");
        		GameStateManager.getInstance().deactivateChildNamed("PlanetaMarinus");        		
        		GameStateManager.getInstance().activateChildNamed("MenuPlaneta");
        	}
        	
        	if (control.getName().equals("pause")) {
        		Jogo.getInstance().togglePause();
        	}
        }
    }
}
